﻿using UnityEngine;
using System.Collections;

public class FX_move : MonoBehaviour {

	public Vector3 vPositionValue = new Vector3 (0, 0, 0);

	public float fTimeScale = 1.0f;
	
	Vector3 vOriginalPos;
	float timer = 0;
	
	[SerializeField]
	AnimationCurve curveX;
	[SerializeField]
	AnimationCurve curveY;
	[SerializeField]
	AnimationCurve curveZ;


	void Start(){
		vOriginalPos = transform.localPosition;
	}

	void Update ()
	{

		Vector3 localPosition = transform.localPosition;
		localPosition.x = curveX.Evaluate(timer*fTimeScale)* vPositionValue.x;
		localPosition.y = curveY.Evaluate(timer*fTimeScale)* vPositionValue.y;
		localPosition.z = curveZ.Evaluate(timer*fTimeScale)* vPositionValue.z;
		transform.localPosition = localPosition + vOriginalPos;

		timer += Time.deltaTime;
	}
	

}
